home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
coding
/
dsp
/
aib2xmpl.exe
/
ADDA_C.ASM
< prev
next >
Wrap
Assembly Source File
|
1991-08-02
|
7KB
|
122 lines
;**************************************************************
;
; adda_c.asm
;
; Jeffrey Schwartz
;
; 08-02-91
;
; (C) Texas Instruments Inc., 1992
;
; Refer to the file 'license.txt' included with this
; this package for usage and license information.
;
;**************************************************************
******************************************************************************
* *
* TMS320C25 A/D TO D/A LOOPBACK TEST WITH C-CALLABLE FUNCTIONS *
* *
* AUTHOR: Jeffrey Schwartz *
* DSP Applications *
* Texas Instruments *
* *
* THIS PROGRAM READS A VALUE FROM THE A/D AND WRITES IT BACK OUT TO THE D/A. *
* SINCE THIS PROGRAM IS INTERRUPT DRIVEN, AN INTERRUPT IS CAUSED EVERY TIME *
* A NEW INPUT SAMPLE IS READY TO BE FED INTO THE LOOPBACK. THE INTERRUPT *
* MASK REGISTER (IMR) IS MASKED TO ONLY ALLOW INT0. THE IDLE INSTRUCTION IS *
* USED TO ENABLE THIS INTERRUPT AND WAIT UNTIL IT IS ACTIVATED. *
* *
* IT IS ASSUMED THAT A 5 MHZ CRYSTAL IS BEING USED TO GENERATE THE SAMPLE *
* RATE OF THE AIB2. THE SAMPLE RATE CLOCK IS AT PORT ADDRESS 3. THE VALUE *
* THAT IS OUTPUT TO THIS CLOCK DETERMINES THE SAMPLE FREQUENCY OF THE AIB2 *
* WITH THE FOLLOWING CONVERSION: SAMPLE FREQUENCY = (5 MHZ) / (65535 - VALUE)*
* WHERE VALUE IS THE 16 BIT QUANTITY WRITTEN TO THE SAMPLE RATE CLOCK. *
* *
* SINCE THIS EXAMPLE INCLUDES ASSEMBLY AND C CODE, THE MAKEFILE MUST COMBINE *
* THE TWO, AS IS DONE IN ADDAMAKE.MAK . THE .CMD FILE MUST BE USED TO *
* ALLOCATE THE "ORG" AND "BODY" SECTIONS OF MEMORY. *
* *
* WITHOUT PROPER SETTING OF THE JUMPERS, THE AIB2 MAY NOT WORK WITH THIS *
* PROGRAM. THE PROPER SETTINGS ARE AS FOLLOWS: *
* *
* *
* AIB2 JUMPER SETTINGS *
* JUMPER SETTING JUMPER DESCRIPTION *
* E1 OFF ;MC/MP select A=MP(Vcc) B=MC(GND) >> WARNING! << *
* E2 A ;A:INT0, B:INT1, C:INT2 *
* E3 B-C ;A:BIOZ, B:INT , C:Use C17 and AIC together *
* E4 A ;A:End of conversion, B:Sample rate clock *
* E5 B ;A:Bypass S/H, B:Use sample and hold *
* E6 B ;A:20V range, B:10V range *
* E7 ON ;ON:Connects analog and digital ground *
* E8 A ;A:A/D for input, B:Codec/AIC for input *
* E9 B ;A:Input anti-alias filter, B:Bypass anti-alias *
* E10 OFF ;ON:Connect Vcc to C10/15 *
* E11 A ;EPROM type select (see AIB manual) *
* E12 A ;A:Start conv. on sample rate clk, B:start on A/D read*
* E13 A ;EPROM type select (see AIB manual) *
* E14 OFF ;If installed, supplies 8khz frame synch to CODEC *
* E15 A ;EPROM type select (see AIB manual) *
* E16 ON ;If installed, supplies 2.048 Mhz clock to CODEC *
* E17 OFF ;ON: AIC in byte mode OFF:AIC in word mode *
* E18 OFF ;ON: ties FSR & FSX together for CODEC operation *
* E19 OFF ;ON: ties FSR & FSX to C17 FSR *
* E20 B ;A:select audio power amp B:bypass amplifier *
* E21 A or B ;A:bypass smoothing filter for P2 output B: add filter*
* E22 A ;A:16 bit DAC as P2 output B:CODEC/AIC as output *
* E23 OFF ;A:generate clock B:use emulator clock *
* E24 OFF ;ON:1 I/O wait state OFF:No I/O wait state *
* E25 OFF ;ON:use program wait states OFF:No program wait states*
* E26 OFF ;ON:2 program wait states OFF:0 or 1 prog wait states *
* E27 OFF ;ON:2 I/O wait states OFF:1 or 2 I/O wait states *
* E28 ON ;ON:connects V+ to TB1 OFF:disconnects V+ *
* E29 ON ;ON:connects V- to TB1 OFF:disconnects V- *
* E30 B ;A:Use 2792 EPROM B:standard EPROM *
* E31 B ;A:Use 2792 EPROM B:standard EPROM *
* E32 B ;A:Use 2792 EPROM B:standard EPROM *
* E33 B ;A:Use 2792 EPROM B:standard EPROM *
* E34 OFF ;ON:connects DX0 and DX1 of C17 (second serial port) *
* E35 OFF ;ON:connects DR0 and DR1 of C17 (second serial port) *
* *
* NOTE THAT SOME OF THESE SETTINGS, SUCH AS THOSE FOR EPROM CONFIGURATION *
* ARE UNNECESSARY FOR THIS APPLICATION. *
******************************************************************************
IMR .set 04h
.global _set_rate
.global _tcv_adda
.sect "ORG"
RESET B _tcv_adda ; SIMPLIFIED ISRS
B RESET
B RESET
B RESET
.space 16*16
B RESET
B RESET
B RESET
B RESET
.sect "BODY"
* WHEN ASSEMBLY FUNCTIONS ARE CALLED FROM C, ARP = 0 *
_set_rate ; THE INITIAL UNDERSCORE ALLOWS C-CALLABILITY
SFSM
RTXM
SST *- ; SAVE ST0
LDPK 0
LACK 01h ; SET INTERRUPT MASK REGISTER (IMR)
SACL IMR ; TO ENABLE INT0
OUT *+, PA3 ; OUTPORT RateValue TO SAMPLE RATE CLOCK
LST *
RET
_tcv_adda
IN *, PA2 ; READ A/D
OUT *, PA2 ; WRITE D/A
IDLE ; WAIT FOR NEXT SAMPLE
RET
.end